# 求最大公约数的函数
def gcd(x, y):
    (x, y) = (y, x) if x > y else (x, y)
    for factor in range(x, 0, -1):
        if x % factor == 0 and y % factor == 0:
            return factor


# 求最小公倍数
def lcm(x, y):
    return x * y // gcd(x, y)


def foo():
    b = 'hello'

    def bar():
        c = True
        nonlocal b
        b = 'world'
        print('a=', a)
        print('b=', b)
        print('c=', c)

    bar()
    print('b2 = ', b)


if __name__ == '__main__':
    a = 100
    foo()
    print(a)  # 100
